//
//  photoCollectionView.m
//  项目一
//
//  Created by nick on 15/7/23.
//  Copyright (c) 2015年 nick. All rights reserved.
//

#import "photoCollectionView.h"
#import "photoCollectionViewCell.h"
@implementation photoCollectionView
- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        self.delegate = self;
        self.dataSource = self;
        [self registerClass:[photoCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
        self.pagingEnabled = YES;

        
    }
    return self;
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.imageUrlArray.count;
}
- (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    photoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.imageUrl = _imageUrlArray[indexPath.row];
    
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
    photoCollectionViewCell *photoCell = (photoCollectionViewCell*)cell;
    UIScrollView *subView = (UIScrollView*)[photoCell.contentView viewWithTag:1];
    subView.zoomScale = 1;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
